﻿help = {
    lang = 'english',
    title = 'SmartText help file',
    catalog = {
        intro = 'Introduction',
        getting_started = 'Getting Started',
        template = 'Template',
        var = 'Variable',
        control = 'Flow Controlling',
        param = 'Parameter',
        param_csv = 'CSV Parameter File',
        param_xml = 'XML Parameter File',
        param_lua = 'LUA Parameter File',
        error_handling = 'Error Handling',
        error_lua = 'Lua Error',
        error_undefine_var = 'Undefined Variable Error',
        cmd_line = 'Command Line',
        use_ltt = 'Using LuaTextTemplate in your own code',
        about = 'About'
    },
    intro1 = [[
        SmartText is a tool of generating text.<br />
        It can help you rapidly generating lots of text (Like code, report, configuration files, etc.).This help file is also generated by SmartText.<br />
        SmartText has a built-in text template engine (similar to Velocity), also provides a fancy and friendly GUI for better user experience.
    ]],
    intro2 = [[
        Features :<ul>
        <li>Use very simple Lua syntax to create template (extremely flexible!)</li>
        <li>Support 3 types of parameter files</li>
        <ul>
            <li>.csv</li>
            <li>.xml</li>
            <li>.lua</li>
        </ul>
        <li>Support command line arguments</li>
        <li>Support multi-languages(English, Chinese and Japanese)</li>
        <li>Friendly GUI</li>
        </ul>
    ]],
    intro3 = [[
        SmartText needs to be run on Windows XP/Vista/7 and above OS.<br />
        Also needs .Net Framework 4.0 and above installed.<br />
        Double click SmartText.exe to run.<br />
    ]],
    intro4 = [[
        Nice GUI huh? OK, let’s see what SmartText can do for you.
    ]],
    intro5 = [[
        Making Template File<br />
        Type following text by using any your favorite text editor, and save to "template.txt"(any location) <br />
    ]],
    intro6 = [[
        Making Parameter File<br />
        Again, type following text, save to "parameter.xml"(any location).<br />
    ]],
    intro7 = [[
        Using SmartText<br />
        In "Template File", select saved "template.txt" file, <br />
        In "Parameter File", select saved "parameter.xml" file, <br />
        Leave "Output File" empty, <br />
        Click "Generate" button, if everything's ok, you will see the following output text :<br />
    ]],
    intro8 = [[
        So, smart as you can figure out SmartText's capability?
    ]],
    template1 = [[
        SmartText's template is a skeleton of the text to be generated.<br />
        There are some marks in template, to distinguish normal text and special text.<br />
        SmartText mainly uses Lua syntax as template syntax,<br />
        So if you’re familiar with Lua, you will easily grasp SmartText's template.<br />
        if not, it's ok, you just need to learn a couple of simple structures.<br />
    ]],
    template2 = [[
        By passing through the example in <a href="#getting started">Getting Started</a>, you should probably know the syntax of variable in SmartText's template:<br />
    ]],
    template3 = [[expression]],
    template4 = [[
        Any valid expression of Lua, SmartText will evaluate it, and replace its representation with evaluating result.<br />
        Due to Lua, we can easily set a default value to a variable, like :<br />
    ]],
    template5 = [[
        If person.name is nil (means nothing in Lua), use the value after "or"(here is a string "somebody").<br />
        Note that string can be surrounded by either double quote (") or single quote (') in Lua.<br />
        <br />
        All the examples before demonstrate a very important thing, using dot (.) to express hierarchical data structure.<br />
        We look into that in more detail later in <a href="#parameter">Parameter</a><br />
    ]],
    template6 = [[Flow Controlling]],
    template7 = [[
        In template, condition statement (if) and repeat statement (for) can be used to control the flow of text generating.<br />
        Because SmartText uses Lua inside (The template will be parsed into Lua code), so all the flow controlling statements use standard Lua syntax.<br />
        Only need to use #{} form.<br />
    ]],
    template8 = [[Lua statement]],
    template9 = [[
        See the following example:
    ]],
    template10 = [[
		In this example, if statement is used to make decision between "child" and "adult".<br />
		By using the previous xml parameter, the output text will be:<br />
    ]],
    template11 = [[
        Here is the complete syntax of if in Lua:
    ]],
    template12 = [[
		Lua operator can also be used in condition statement. Following is a brief table of operators.
    ]],
    template13 = [[
        Operator
    ]],
    template14 = [[
        Meaning
    ]],
    template15 = [[
        Equal
    ]],
    template16 = [[
        Not Equal
    ]],
    template17 = [[
        Less than
    ]],
    template18 = [[
        Great than
    ]],
    template19 = [[
		Less than or Equal to
    ]],
    template20 = [[
        Great than or Equal to
    ]],
    template21 = [[
        And
    ]],
    template22 = [[
        Or
    ]],
    template23 = [[
        Not
    ]],
    template24 = [[
		For statement is very useful, it can repeatedly generate a part of text.<br />
		For statement has two forms: one numeric and one generic. Let’s see the first.
    ]],
    template25 = [[
		This template is so simple even need no parameter to generate result:<br />
    ]],
    template26 = [[
		Following is the syntax of numeric form:
    ]],
    template27 = [[
		exp1 is the initial value,<br />
		exp2 is the termination value,<br />
		exp3 is the step value, when omitted, 1 as default.
    ]],
    template28 = [[
		However, in practice, we often use another form: generic for <br />
        Before demonstration, we need to expand our parameter file:
    ]],
    template29 = [[
		Then use generic for like this:
    ]],
    template30 = [[
		The result:
    ]],
    template31 = [[
		SmartText parses XML parameter into Lua code (detail in <a href="#parameter">Parameter</a>), <br />
        "person" is a Lua Table(used as an array here), can be accessed by "list.person".<br />
        SmartText provides a very handy function "enum" to enumerate element of a Table,<br />
        So "enum(list.peronson)" is enumerating every person, which is assigned to "p".<br />
    ]],
    template32 = [[
        <li>Technical Details:</li><br />
		"enum" is a function provided by SmartText, not by Lua, <br />
		"enum" can enumerate not only array-form Table in Lua, but also .Net array, collection(List, Dictionary, etc.), and all objects that implement the IEnumerable interface, <br />
		When enumerating Lua Table, it's similar to Lua function "ipairs", the difference is, ipairs returns two values(index and value), but enum only returns value.<br />
		About specific implementation of enum function, you can view the source code of SmartText.
    ]],
    template33 = [[
		The syntax of generic for:
    ]],
    template34 = [[
		Above is all the explanations about flow controlling, mainly if and for, but SmartText and Lua have a very flexible combination, <br />
		In fact, you can insert any valid Lua statements into #{...}, they will be parsed into Lua code and executed.<br />
		You can define global variables in #{...}, and use it somewhere else.<br />
		You can even define functions, in order to implement macros like Velocity does.
	    ]],
    param1 = [[
		SmartText supports three types of parameter files (CSV XML LUA), even though they have similar usage (provide data to template),<br />
		but each type has its own advantages and disadvantages, you should use appropriate type on different occasions.<br />
		SmartText parses CSV and XML parameter files to Lua code. You needn't to grasp the details of parsing, only need to know how to use data correctly.
    ]],
    param2 = [[
		CSV parameter file is the easiest type, it has a straightforward data relationship. You can use EXCEL to edit CSV files.<br />
		The row-column form is also correspond to database table, so if you want to use a database table as a parameter, then, the CSV parameter file is most appropriate.<br />
		However, CSV parameter file cannot represent hierarchical relationships of data structure, then you need to consider the use of XML or LUA parameter files.
	]],
    param3 = [[
        Example:
    ]],
    param4 = [[
		Template file:
    ]],
    param5 = [[
        Parameter file
    ]],
    param6 = [[
        Generated result:
    ]],
    param7 = [[
		Since CSV file has no root element like XML file, so SmartText uses CSV file name as a prefix of each variable.<br />
		In above example, the CSV parameter file's name is "parameter", so the prefix of each variable is "parameter".<br />
		Use subscript form "parameter[1]" to access the the line "WAKU,29" (the subscripts of Lua array starts from 1), <br />
		Access the content of column "name" is also straightforward: "parameter[1].name".<br />
	    ]],
    param8 = [[
		<li>Technical Details:</li><br />
		Actually, the parameter has become to a Lua Table.<br />
		SmartText parses CSV parameter files into nested Table, <br />
		Each line in CSV file (exclude the first line, it is the header line) will be parsed into a child Table.<br />
		The parsing result of the CSV file in previous example is as follows:
    ]],
    param9 = [[
		The above example works well, though; the template was slightly awkward, <br />
		Using generic for, you can use the following template form to get exactly the same result:
    ]],
    param10 = [[
		It is worth mentioning that, SmartText uses LumenWorks parsing CSV files, LumenWorks is the best .Net CSV parser in my opinion.
    ]],
    param11 = [[
		XML is a very popular file format, and has good compatibility. The tree-form is very suitable to represent the data structure with a hierarchical relationship.<br />
		.Net also have an excellent support for XML, you can serialize an object to XML file, a Dataset object can be directly written to XML file and so on.<br />
		The disadvantage of XML file maybe somewhat lengthy, editing is a little inconvenient without a handy tool.<br />
		Same with CSV, SmartText parses XML parameter file into Lua code.
    ]],
    param12 = [[
		This example demonstrates how to access the content of XML parameter correctly.<br />
		Just remember a few simple rules: <br />
		1. Variables start from the root node ("list" in the example) <br />
		2. Use DOT (.) to access attribute (like "name" and "age" in the example) <br />
		3. Also use DOT (.) to access child node <br />
		4. If a node appears more than once, it is an array, you can use the "enum" function for enumeration (like "person" and "food" in the example) <br />
		<br />
		There is a new function "join", it's also provided by SmartText.<br />
		It is used to concatenate string elements of an array, the first argument is same with "enum"(.Net array, collection or Lua Table); the second argument separator is optional, default is a comma(,).<br />
    ]],
    param13 = [[
		<li> Technical Details: </ li> <br />
		The parsing result of the XML file in previous example is as follows:
	]],
    param14 = [[
		Lua parameter file is the most efficient of the three types (as both CSV and XML are required to parse into Lua code first), and also the most flexible one.<br />
		Its disadvantage is not very popular, and using it needs a certain knowledge of Lua.<br />
		Lua parameter file can get exactly same result of previous examples, just use the Lua code in the technical details as a Lua parameter file.<br />
		But there are something that CSV and XML cannot do.
    ]],
    param15 = [[
		If you use CSV or XML, you have to quote the CSV template file name or the name of the XML root node, <br />
		The parameter also needs to be split by comma or placed into XML-TAG, while Lua parameter is very straightforward.<br />
		Note, however, that all these variables are defined as global, so you need to pay attention to naming conflicts.<br />
		Of course, if there are pretty much variables, you should get them organized by using Lua Table.
    ]],
    error1 = [[
		If an error was raised when generating text, SmartText will display the error message in the textbox with red color.
    ]],
    error3 = [[
		As mentioned before, SmartText parses the content of the template into Lua code, so the template should meet Lua syntax requirement, otherwise Lua compiler will complain. <br />
		Another case is that there's no syntax error in template, but the Lua code raises a runtime-error, <br />
		Anyway, SmartText will get the error message and display into the text box.<br />
		Look at the following example:
    ]],
    error4 = [[
		The template does not require a parameter file to run, but an error occurs:
    ]],
    error5 = [[
		The first line of the text box is the Lua compiler error messages, a compilation error is in the format [string "chunk"]: <i> line </i>: <br />
		Here <i>line</i> is the line number of the wrong Lua code. Following is a detailed description of the error ("do" was missing) <br />
		After second line is the parsed Lua code based on the template, for ease of viewing, SmartText added the line number before each line.<br />
		<br />
		From the parsed Lua code, we can see some details of processing template in SmartText: <br />
		1. The content in flow controlling #{...} is parsed directly into Lua code (like "for" and "end" in the example); <br />
		2. "RenderText" is a SmartText's internal function, which returns the generated text; <br/>
		3. Use [=[ and ]=] to surround normal string, prevent string from being escaped; <br />
		4. "return 0" at last is a fixed statement added by SmartText
    ]],
    error6 = [[
		When variable used does not exist in parameter, this error occurs, such as the following template: <br />
    ]],
    error7 = [[
		If you do not use any parameter file, the template will raise the following error:
    ]],
    error8 = [[
		Error message clearly indicates which variable does not exist, and the location where variable appears.
	]],
    error9 = [[
		In addition, if you specify a parameter file, SmartText will also append the parsed Lua code of the parameter file to the end of the text box in order to analyze the error.
    ]],
    cmd1 = [[
		SmartText can use the command-line parameters in the following format:
    ]],
    cmd2 = [[
		Respectively, template file, parameter file, output file, encoding of template file, encoding of parameter file, encoding of output file.<br />
		Where the template file must be specified, the others can be omitted.<br />
		The 4th to 6th parameter is required to be the Code Page of the encoding (an integer),  you can get it in the setting window of SmartText.<br />
		Here is an example of using the command-line parameters:
    ]],
    cmd3 = [[
		Use "d:\template.txt" as template file, no parameter file, uses "d:\output.txt" as output file, the template file encoding is GB2312, and the output file encoding is UTF-8.
    ]],
    cmd4 = [[
		When successes, the output file will be generated and a zero value will be returned, in addition to this, no any other prompt.<br />
		If failed, the GUI of SmartText will be displayed, the methods described in <a href="#error handling">Error Handling</a> will help you figure out what went wrong.
    ]],
}